Class Feindura File source: /library/classes/Feindura.class.php

Class Overview
FeinduraBase
   |
   --Feindura

Description

The class for implementing feindura - Flat File Content Management System in a website.

It's methods provide necessary functions for implementing the CMS in a website.
It contains, for example, methods for building a menu and get page contents, etc.


Additional
Version
  • 1.0.1
    ChangeLog
    • 1.0.1 add setStartPage()
    • 1.0 initial release
Class located in /library/classes/Feindura.class.php [in line 42]
Inherited Properties, Constants, and Methods
Inherited Properties Inherited Methods Inherited Constants
Inherited From FeinduraBase
FeinduraBase::$adminConfig
FeinduraBase::$categoryConfig
FeinduraBase::$language
FeinduraBase::$languageFile
FeinduraBase::$loggedIn
FeinduraBase::$sessionId
FeinduraBase::$varNames
FeinduraBase::$websiteConfig
Inherited From FeinduraBase
FeinduraBase::__construct()
Type constructor
FeinduraBase::compareTags()
Name compareTags()
FeinduraBase::createAttributes()
Name createAttributes()
FeinduraBase::createThumbnail()
Name createThumbnail()
FeinduraBase::createTitle()
Name createTitle()
FeinduraBase::generatePage()
Name generatePage()
FeinduraBase::getCurrentCategoryId()
Name getCurrentCategoryId()
Alias getCategoryId()
FeinduraBase::getCurrentPageId()
Name getCurrentPageId()
Alias getPageId()
FeinduraBase::getPropertyCategory()
Name getPropertyCategory()
FeinduraBase::getPropertyIdsByString()
Name getPropertyIdsByString()
FeinduraBase::getPropertyIdsByType()
Name getPropertyIdsByType()
FeinduraBase::getPropertyPage()
Name getPropertyPage()
FeinduraBase::hasTags()
Name hasTags()
FeinduraBase::loadFrontendLanguageFile()
Name loadFrontendLanguageFile()
FeinduraBase::loadPagesByDate()
Name loadPagesByDate()
FeinduraBase::loadPagesByType()
Name loadPagesByType()
FeinduraBase::replaceLinks()
Name replaceLinks()
FeinduraBase::setCurrentCategoryId()
Name setCurrentCategoryId()
Alias setCategoryId()
FeinduraBase::setCurrentPageId()
Name setCurrentPageId()
Alias setPageId()
FeinduraBase::shortenHtmlText()
Name shortenHtmlText()
FeinduraBase::shortenText()
Name shortenText()
Property Summary
bool   $xHtml   TRUE when the pages content should be handled as XHTML.
int   $page   Contains the current page ID get from the $_GET variable.
int   $category   Contains the current category ID get from the $_GET variable.
int   $startPage   Contains the startpage ID from the website-settings config.
int   $startCategory   Contains the startcategory ID
int|false   $linkLength   The number of maximal visible characters in the link text of any link created by createLink() or createMenu().
string|false   $linkId   Contains an id-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().
string|false   $linkClass   Contains an class-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().
string|false   $linkAttributes   Contains a string with attributes which will be add to any <a ...> tag of any link created by createLink() or createMenu().
string|false   $linkBefore   Contains a string which will be add before any <a></a> tag of any link created by createLink() or createMenu().
string|false   $linkAfter   Contains a string which will be add after any <a></a> tag of any link created by createLink() or createMenu().
string|false   $linkBeforeText   Contains a string which will be add before the link text but inside any <a></a> tag of any link created by createLink() or createMenu().
string|false   $linkAfterText   Contains a string which will be add after the link text but inside any <a></a> tag of any link created by createLink() or createMenu().
bool   $linkShowThumbnail   If TRUE and the page has a thumbnail it places the thumbnail <img> tag inside the <a></a> tag of any link created by createLink() or createMenu().
bool   $linkShowThumbnailAfterText   If TRUE and thumbnail <img> tag will be placed after the link text but inside the <a></a> tag of any link created by createLink() or createMenu().
bool   $linkShowPageDate   If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the link text of any link created by createLink() or createMenu().
string   $linkPageDateSeparator   If the $linkShowPageDate property is TRUE, this string will be used as a separator between the page date and the link text of any link created by createLink() or createMenu().
bool   $linkShowCategory   If TRUE, the category name of the page will be add before the link text with the $linkCategorySpacer property as separator of any link created by createLink() or createMenu().
string   $linkCategorySeparator   If the $linkShowCategory property is TRUE, this string will be used as a separator between the category name and the link text of any link created by createLink() or createMenu().
string|false   $menuId   Contains an id-Attribute which will be add to the menu tag.
string|false   $menuClass   Contains an class-Attribute which will be add to the menu tag.
string|false   $menuAttributes   Contains a string with attributes which will be add to the menu tag.
int|false   $titleLength   A number of maximal characters visible in the page title.
bool   $titleAsLink   If TRUE the page title is also a link to the page.
bool   $titleShowPageDate   If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the page title.
string   $titlePageDateSeparator   If the $titleShowPageDate property is TRUE, this string will be used as a separator between the page date and the page title.
bool   $titleShowCategory   If TRUE, the category name of the page will be add before the page title with the $linkCategorySpacer property as separator.
string   $titleCategorySeparator   If the $titleShowCategory property is TRUE, this string will be used as a separator between the category name and the page title.
string|false   $thumbnailAlign   Contains the position of the thumbnail picture, the possible values are "left", "right" or FALSE.
string|false   $thumbnailId   Contains an id-Attribute which will be add to the thumbnail <img> tag.
string|false   $thumbnailClass   Contains an class-Attribute which will be add the thumbnail <img> tag.
string|false   $thumbnailAttributes   Contains a string with attributes which will be add the thumbnail <img> tag.
string|false   $thumbnailBefore   Contains a string which will be add before the thumbnail <img> tag.
string|false   $thumbnailAfter   Contains a string which will be add after the thumbnail <img> tag.
bool   $showErrors   If TRUE an error will be displayed if the requested page doesn't exists or is currently not public.
string|false   $errorTag   The tag which should be used for the error message.
string|false   $errorId   Contains an id-Attribute which will be add to the error tag.
string|false   $errorClass   Contains an class-Attribute which will be add to the error tag.
string|false   $errorAttributes   Contains a string with attributes which will be add the error tag.
Method Summary
void   __construct()   The constructor of the class, sets all basic properties. Run the FeinduraBase::__construct() class constructor to...
void   setStartPage()   Set a page ID to the $startPage and $page property.
string|false   setLanguage()   Set the FeinduraBase::$language property and reloads the frontend language file. Notice The country code will...
string   getLanguage()   Returns the language country code which was set in the feinduraBase:__construct().
array   getLanguageFile()   Check a specific directory for files which have a language code inside the filename (see $filename parameter)....
string   createMetaTags()   Creates a string with basic HTML5 meta tags. See the example for a detailed list of the meta tags created. Notice...
string|false   createHref()   Generates a href attribute which links to a page. Depending whether speaking URLs is in the administrator-settings...
string|false   createLink()   This method uses the $link... and $thumbnail... properties. Creates a link from a page ID. If the given...
array   createMenu()   This method uses the $link... , $menu... and $thumbnail... properties. Creates a menu from category or page...
array   createMenuByTags()   This method uses the $link... , $menu... and $thumbnail... properties. Create a menu from category or page...
array   createMenuByDate()   This method uses the $link... , $menu... and $thumbnail... properties. Creates a menu from category or page...
array   createMenuBySortFunction()   Alias createMenuBySort() Alias createMenuBySortCallback() Alias createMenuByCallback() This...
string   getPageTitle()   This method uses the $title... properties. Returns the title of a page. This page title will be generated...
array   showPage()   This method uses the $error... , $title... and $thumbnail... properties. Returns a page for displaying in a...
bool   hasPlugins()   Alias hasPlugin() Alias isPlugins() Alias isPlugin() Check whether the given plugin(s) are activated for...
array|string|false   showPlugins()   Returns the plugin(s) of a page ready for displaying in a HTML page. It can return an array where each element...
array   listPages()   This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or...
array   listPagesByTags()   This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or...
array   listPagesByDate()   This method uses the $error... , $title... and $thumbnail... properties. List pages by given category or...
array   listPagesBySortFunction()   Alias listPagesBySort() Alias listPagesBySortCallback() Alias listPagesByCallback() This...
Properties
bool $xHtml = false

Default value

false

Description

TRUE when the pages content should be handled as XHTML.

In XHTML standalone tags end with " />" instead of ">".
Therefor when a page content is displayed and this property is FALSE all " />" will be changed to ">".


Additional
  • access: public
int $page = null

Default value

null

Description

Contains the current page ID get from the $_GET variable.

This property is used when a page loading method is called (for example: showPage()) and no page ID parameter is given.

This property will be set in the feindura() constructor through the setCurrentPageId() method.


Additional
int $category = null

Default value

null

Description

Contains the current category ID get from the $_GET variable.

This property is used when a page-loading method is called (for example: showPage()) and no category ID parameter is given.

This property will be set in the feindura() constructor through the setCurrentCategoryId() method.


Used By
Additional
int $startPage = null

Default value

null

Description

Contains the startpage ID from the website-settings config.

This property is set to the $page property when the $_GET page variable and the $page property is empty and setting a startpage is activated in the page-settings.

This property will be set in the feindura() constructor through the setCurrentPageId() method.


Used By
Additional
int $startCategory = null

Default value

null

Description

Contains the startcategory ID

Its fetched from the $startPage through the GeneralFunctions::getPageCategory() method.
This property is set to the $category property when the $_GET category variable and the $category property is empty and setting a startpage is activated in the page-settings.

This property will be set in the feindura() constructor through the setCurrentCategoryId() method.


Used By
int|false $linkLength = false

Default value

false

Description

The number of maximal visible characters in the link text of any link created by createLink() or createMenu().

The link text will be shorten to the last complete word.

For example the following string will be shorten to a $linkLength of "30": "Example Category -> Example Page Title" => "Example Category -> Example..."


Additional
string|false $linkId = false

Default value

false

Description

Contains an id-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().

Notice: You can only set one specific id-Attribute to elements in a HTML page, if you set this property and call createMenu() every link in the menu will get this id-Attribute.


Additional
string|false $linkClass = false

Default value

false

Description

Contains an class-Attribute which will be add to any <a ...> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this class-Attribute.


Additional
string|false $linkAttributes = false

Default value

false

Description

Contains a string with attributes which will be add to any <a ...> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this attributes string.

The string should have the following format 'key1="value" key2="value"'


Additional
string|false $linkBefore = false

Default value

false

Description

Contains a string which will be add before any <a></a> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this string.


Additional
string|false $linkAfter = false

Default value

false

Description

Contains a string which will be add after any <a></a> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this string.


Additional
string|false $linkBeforeText = false

Default value

false

Description

Contains a string which will be add before the link text but inside any <a></a> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this string.


Additional
string|false $linkAfterText = false

Default value

false

Description

Contains a string which will be add after the link text but inside any <a></a> tag of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will get this string.


Additional
bool $linkShowThumbnail = false

Default value

false

Description

If TRUE and the page has a thumbnail it places the thumbnail <img> tag inside the <a></a> tag of any link created by createLink() or createMenu().


Additional
bool $linkShowThumbnailAfterText = false

Default value

false

Description

If TRUE and thumbnail <img> tag will be placed after the link text but inside the <a></a> tag of any link created by createLink() or createMenu().


Additional
bool $linkShowPageDate = false

Default value

false

Description

If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the link text of any link created by createLink() or createMenu().

If the $linkShowCategory property is TRUE, the page date is placed between the category name + separator and the link text.
The page date will be added with the page before-date-text and after-date-text from the page editor in the backend

Notice: The page date will only be displayed if the $linkText parameter of createLink() or createMenu() methods is TRUE and not a string.

Example: <a href="?page=2" ...>Catgory Name: 200-12-31 Page Title</a>


Additional
string $linkPageDateSeparator = ' '

Default value

' '

Description

If the $linkShowPageDate property is TRUE, this string will be used as a separator between the page date and the link text of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will use this separator.


Additional
bool $linkShowCategory = false

Default value

false

Description

If TRUE, the category name of the page will be add before the link text with the $linkCategorySpacer property as separator of any link created by createLink() or createMenu().

The category name will only be displayed if the $linkText parameter of createLink() or createMenu() methods is TRUE and not a string.

Example: <a href="?page=2" ...>Catgory Name: Page Title</a>


Additional
string $linkCategorySeparator = ': '

Default value

': '

Description

If the $linkShowCategory property is TRUE, this string will be used as a separator between the category name and the link text of any link created by createLink() or createMenu().

Notice: If you set this property and call createMenu() every link in the menu will use this separator.


Additional
string|false $menuId = false

Default value

false

Description

Contains an id-Attribute which will be add to the menu tag.

Notice 1: This id-Attribute will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.
Notice 2: You can only set one specific id-Attribute to elements in a HTML page.


Additional
string|false $menuClass = false

Default value

false

Description

Contains an class-Attribute which will be add to the menu tag.

Notice: This class-Attribute will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.


Additional
string|false $menuAttributes = false

Default value

false

Description

Contains a string with attributes which will be add to the menu tag.

Notice: This string with attributes will only be add, if the $menuTag parameter in the createMenu() method is not FALSE.

The string should have the following format 'key1="value" key2="value"'


Additional
int|false $titleLength = false

Default value

false

Description

A number of maximal characters visible in the page title.

The page title will be shorten to the last complete word.

For example the following string will be shorten to a $titleLength of "30": "Example Category -> Example Page Title" => "Example Category -> Example..."


Additional
bool $titleAsLink = false

Default value

false
bool $titleShowPageDate = false

Default value

false

Description

If TRUE, page dates are allowed for the pages in this category and the page has a page date then it will be add before the page title.

If the $titleShowCategory property is TRUE, the page date is placed between the category name + separator and the page title.
The page date will be added with the page before-date-text and after-date-text from the page editor in the backend.

Example: Catgory Name: 200-12-31 Page Title


Additional
string $titlePageDateSeparator = ' '

Default value

' '

Description

If the $titleShowPageDate property is TRUE, this string will be used as a separator between the page date and the page title.


Additional
bool $titleShowCategory = false

Default value

false

Description

If TRUE, the category name of the page will be add before the page title with the $linkCategorySpacer property as separator.

Example: Catgory Name: Page Title


Additional
string $titleCategorySeparator = ': '

Default value

': '

Description

If the $titleShowCategory property is TRUE, this string will be used as a separator between the category name and the page title.


Additional
string|false $thumbnailAlign = false

Default value

false

Description

Contains the position of the thumbnail picture, the possible values are "left", "right" or FALSE.

If the values are "left" or "right" a style-attribute will be add to the thumbnail <img> tag with "float:left/right;".

Notice: If you set this property, you can't add any style attribute with the $thumbnailAttributes property anymore, it would not be used by the browser.

<img src="/path/image.png" ... style="float:left;" />


Additional
string|false $thumbnailId = false

Default value

false

Description

Contains an id-Attribute which will be add to the thumbnail <img> tag.

Notice: You can only set one specific id-Attribute to elements in a HTML page.


Additional
string|false $thumbnailClass = false

Default value

false

Description

Contains an class-Attribute which will be add the thumbnail <img> tag.


Additional
string|false $thumbnailAttributes = false

Default value

false

Description

Contains a string with attributes which will be add the thumbnail <img> tag.

The string should have the following format 'key1="value" key2="value"'


Additional
string|false $thumbnailBefore = false

Default value

false

Description

Contains a string which will be add before the thumbnail <img> tag.


Additional
string|false $thumbnailAfter = false

Default value

false

Description

Contains a string which will be add after the thumbnail <img> tag.


Additional
bool $showErrors = true

Default value

true

Description

If TRUE an error will be displayed if the requested page doesn't exists or is currently not public.

Example: <span>The requested page is currently not available.</span>


Additional
string|false $errorTag = 'span'

Default value

'span'

Description

The tag which should be used for the error message.

Notice: If this property is no string, the $errorId, $errorClass and $errorAttributes property will not be add.

Example: <span>The requested page is currently not available.</span>


Additional
  • var: If no tag should be add, set it to FALSE.
  • see: Feindura::showPage()
  • see: feindura:generatePage()
  • example: example
  • access: public
string|false $errorId = false

Default value

false

Description

Contains an id-Attribute which will be add to the error tag.

Notice 1: This id-Attribute will only be add, if the $errorTag property is a string and not FALSE.
Notice 2: You can only set one specific id-Attribute to elements in a HTML page.

Example: <span id="exampleId">The requested page is currently not available.</span>


Additional
  • var: If no id-Attribute should be add, set it to FALSE.
  • see: Feindura::showPage()
  • see: feindura:generatePage()
  • example: example
  • access: public
string|false $errorClass = false

Default value

false

Description

Contains an class-Attribute which will be add to the error tag.

Notice: This class-Attribute will only be add, if the $errorTag property is a string and not FALSE.

Example: <span class="exampleId">The requested page is currently not available.</span>


Additional
  • var: If no class-Attribute should be add, set it to FALSE.
  • see: Feindura::showPage()
  • see: feindura:generatePage()
  • example: example
  • access: public
string|false $errorAttributes = false

Default value

false

Description

Contains a string with attributes which will be add the error tag.

The string should have the following format 'key1="value" key2="value"'

Example: <span key1="value" key2="value">The requested page is currently not available.</span>


Additional
  • var: If no additional attributes should be add, set it to FALSE.
  • see: Feindura::showPage()
  • see: feindura:generatePage()
  • example: example
  • access: public
Methods
File source:
line 775
void Constructor __construct ( [string $language = false])

Parameters

string $language (optional) A country code like "de", "en", ... to load the right frontend language-file and is also set to the FeinduraBase::$language property
Default false

Redefinition of:
FeinduraBase::__construct()
Type constructor

Description

Type constructor

The constructor of the class, sets all basic properties.

Run the FeinduraBase::__construct() class constructor to set all necessary properties Fetch the $_GET variable (if existing) and set it to the $page and $category properties.
If there is no page and category ID it sets the start page ID from the website-settings config.

Example:

  1. <?php
  2.  
  3. // a session will be started in the "feindura.include.php",
  4. // therefor you have to include this file before the header of the HTML page is sent,
  5. // which means before any HTML Tag.
  6. require('cms/feindura.include.php');
  7.  
  8. // creates a new Feindura instance
  9. $myCms new Feindura();
  10.  
  11. ?>


Uses
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 814
void setStartPage ( int $pageId)

Parameters

int $pageId the page ID to set

Description

Name setStartPage()

Set a page ID to the $startPage and $page property.


Additional
  • access: public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 847
string|false setLanguage ( string $language)

Parameters

string $language a language country code like "en", "de", ...

Description

Name setLanguage()

Set the FeinduraBase::$language property and reloads the frontend language file.

Notice The country code will NOT set to any $_SESSION variable, you have to take care of this yourself.


Uses
Return Value
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 878
string getLanguage ( )

Description

Name getLanguage()

Returns the language country code which was set in the feinduraBase:__construct().


Uses
Return Value
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 914
array getLanguageFile ( [string|false $langPath = false],
[string $filename = '%lang%.php'],
[string@false &$currentLangCode = false],
[bool $standardLang = 'en'])

Parameters

string|false $langPath (optional) a absolut path to look for a language file which fit the $filename parameter or FALSE to use the "feindura-cms/library/languages" folder
Default false
string $filename (optional) the structure of the filename, which should be loaded. the "%lang%" will be replaced with the country code like "%lang%.backend.php" -> "en.backend.php"
Default '%lang%.php'
string@false &$currentLangCode (optional) (Note: this variable will also be changed outside of this method) a variable with the current language code, if this is set it will be first try to load this language file, when it couldn't find a language file which fits the browsers language code.
Default false
bool $standardLang (optional) a standard language for use if no match was found
Default 'en'

Description

Name getLanguageFile()

Check a specific directory for files which have a language code inside the filename (see $filename parameter). When a matching file is found it includes these and return it. If no match could be found it try to find a file with the browser language code, if this didnt work either it uses the $standardLang parameter.

Example of a language file

  1. <?php
  2.  
  3. $langFile['SEARCH_TITLE''Search';
  4. $langFile['TITLE_NEWS''What\'s new';
  5. ...
  6.  
  7. return $langFile;
  8.   
  9. ?>

Used Constants

  • DOCUMENTROOT the absolut path of the webserver


Uses
Return Value
  • array - the loaded language file array or an empty array
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 965
string createMetaTags ( [string $charset = 'UTF-8'],
[string|false $author = false],
[string|bool $publisher = true],
[string|bool $copyright = true])

Parameters

string $charset (optional) the charset used in the website like "UTF-8", "iso-8859-1", ...
Default 'UTF-8'
string|false $author (optional) the author of the website
Default false
string|bool $publisher (optional) the publisher of the website, if TRUE it uses the publisher from the website-settings config
Default true
string|bool $copyright (optional) the copyright owner of the website, if TRUE it uses the copyright from the website-settings config
Default true

Description

Name createMetaTags()
Alias createMetaTag()

Creates a string with basic HTML5 meta tags. See the example for a detailed list of the meta tags created.

Notice: You have to call this method in the <head> tags of your website, to enable the frontend editing feature. Notice: This method also adds the Feed tags.

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. */
  5.  
  6. // a session will be started in the "feindura.include.php",
  7. // therefor you have to include this file before the header of the HTML page is sent,
  8. // which means before any HTML Tag.
  9. require('cms/feindura.include.php');
  10.  
  11. // creates a new Feindura instance
  12. $myCms new Feindura();
  13.  
  14. // start to write HTML page
  15. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  16.             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  17.       <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  18.       <head>';
  19.  
  20. // writes the meta tags in the <head>
  21. echo $feindura->createMetaTags('UTF-8','Fabian Vogelsteller'truetruetrue'12');
  22.     
  23. echo '</head>
  24.       <body>
  25.       ...';
  26.  
  27.  
  28.  
  29. /*                              *** RESULT *** 
  30. --------------------------------------------------------------------------------
  31. */
  32.  
  33. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  34.       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  35. <html lang="en" xmlns="http://www.w3.org/1999/xhtml">
  36. <head>
  37.   <meta charset="UTF-8" />
  38.   <meta http-equiv="content-language" content="en" />
  39.  
  40.   <title>
  41.    Welcome feinduraExample.com
  42.   </title>
  43.  
  44.   <meta name="siteinfo" content="robots.txt" />
  45.   <meta name="revisit_after" content="12" />
  46.  
  47.   <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <!-- enable google chrome frameif available -->
  48.   <meta name="viewport" content="width=device-width, initial-scale=0.5" /> <!-- set width for mobile devices -->
  49.  
  50.   <meta name="title" content="feinduraExample.com - Welcome" />
  51.   <meta name="author" content="Fabian Vogelsteller" />
  52.   <meta name="publisher" content="Puslisher written in the Backend" />
  53.   <meta name="copyright" content="Copyright written in the Backend" />
  54.   <meta name="description" content="This example website is intended to show
  55.   how easy it is to use feindura CMS." />
  56.   <meta name="keywords" content="keyword1,keyword2,keyword3,keyword4" />
  57.   
  58.   <link rel="alternate" type="application/atom+xml" title="News - feinduraExample.com (Atom)" href="http://feinduraexample.com/cms/pages/1/atom.xml" />
  59.   <link rel="alternate" type="application/rss+xml" title="News - feinduraExample.com (RSS 2.0)" href="http://feinduraexample.com/cms/pages/1/rss2.xml" />
  60.    
  61. </head>
  62. <body>
  63. ...
  64.  
  65. ?>


Uses
Return Value
  • string - with all meta tags ready to display in a HTML page
Additional
  • access: public
Version
  • 1.01
    ChangeLog
    • 1.01 changed readPage() from getCurrentPage() to use only the page property
    • 1.0 initial release
File source:
line 1187
string|false createHref ( [int|string|array|bool $ids = false])

Parameters

int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false

Description

Name createHref()

Generates a href attribute which links to a page. Depending whether speaking URLs is in the administrator-settings activated, it generates a different href attribute.
If cookies are deactivated it attaches the $sessionId on the end.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>

Examples of the returned href string: ("user=xyz123" stands for: sessionname=sessionid)

Pages without category: '?page=1&user=xyz123' Pages with category: '?category=1&page=1&user=xyz123'

Speaking URL href for pages without category: '/page/page_title.html?user=xyz123' Speaking URL href for pages with category: '/category/category_name/page_title.html?user=xyz123'


Used By
Uses
Return Value
  • string|false - the generated href attribute, or FALSE if no page could be loaded
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1264
string|false createLink ( [int|string|array|bool $ids = false],
[string|bool $linkText = true])

Parameters

int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false
string|bool $linkText (optional) a string with a linktext which the link will use, if TRUE it uses the page title of the page, if FALSE no linktext will be used
Default true

Description

Name createLink()

This method uses the $link... and $thumbnail... properties.

Creates a link from a page ID.

If the given $page parameter is a string with "previous" or "next", it creates a link from the previous or the next page starting from the current page ID stored in the $page property. If there is no current, next or previous page in it returns FALSE.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. <b>Notice</b>: It add the class name <i>"active"</i> to the link, when the current $page property matches the page ID of the link. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call createLink(1) without setting properties
  6. and you have a simple link with the page title.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // set link properties
  18. $myCms->linkLength =                  50// shortens the page title in the link
  19. $myCms->linkId =                      'exampleId';
  20. $myCms->linkClass   =                 'exampleClass';
  21. $myCms->linkAttributes =              'test="exampleAttribute1" onclick="exampleAttribute2"';
  22. $myCms->linkBefore =                  'text before link ';
  23. $myCms->linkAfter =                   ' text after link';
  24. $myCms->linkBeforeText =              'text before ';
  25. $myCms->linkAfterText =               ' text after';
  26. $myCms->linkShowThumbnail =           true;
  27. $myCms->linkShowThumbnailAfterText =  false;
  28. $myCms->linkShowPageDate =            true;
  29. $myCms->linkShowCategory =            true;
  30. $myCms->linkCategorySeparator =       ' -> ';
  31.  
  32. // set thumbnail properties
  33. $myCms->thumbnailAlign =              'left';
  34. $myCms->thumbnailId =                 'thumbId';
  35. $myCms->thumbnailClass =              'thumbClass';
  36. $myCms->thumbnailAttributes =         'test="thumbnailAttr1" onclick="thumbnailAttr2"';
  37. $myCms->thumbnailBefore =             'text before thumbnail ';
  38. $myCms->thumbnailAfter =              ' text after thumbnail';
  39.  
  40.  
  41. // finally create the link from the page with ID "1" using the above set link properties
  42. $link $myCms->createLink(1);
  43.  
  44. // displays the link
  45. echo $link;
  46.  
  47.  
  48. /*                              *** RESULT *** 
  49. --------------------------------------------------------------------------------
  50. */
  51.  
  52. text before link <a href="?category=1&amp;page=1" title="Example Category: 2010-12-31 Example Page"
  53. id="exampleId" class="exampleClass" test="exampleAttribute1" onclick="exampleAttribute2">
  54. text before thumbnail <img src="/path/thumb_page1.png" alt="Thumbnail" title="Example Page"
  55. id="thumbId" class="thumbClass" test="thumbnailAttr1" onclick="thumbnailAttr2" style="float:left;" />
  56. text after thumbnail
  57. text before Example Category2010-12-31 Example.. text after
  58. </atext after link
  59.  
  60. ?>


Used By
Return Value
  • string|false - the created link, ready to display in a HTML-page, or FALSE if the page doesn't exist or is not public
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1424
array createMenu ( [string $idType = 'category'],
[int|array|bool $ids = false],
[int|bool $menuTag = false],
[string|bool $linkText = true],
[int|false $breakAfter = false],
[bool $sortByCategories = false])

Parameters

string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|bool $menuTag (optional) the tag which is used to create the menu, can be an "menu", "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag
Default false
string|bool $linkText (optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used
Default true
int|false $breakAfter (optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect
Default false
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false

Description

Name createMenu()

This method uses the $link..., $menu... and $thumbnail... properties.

Creates a menu from category or page ID(s).

The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary child HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.

In case no page with the given category or page ID(s) exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.
Notice: the link which fits the current ID in the $page property will get the class name "active".

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call createMenu('category',1)
  6. and you have a simple array with links of the pages from this category.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // set menu properties
  18. $myCms->menuId =                      'menuId';
  19. $myCms->menuClass =                   'menuClass';
  20. $myCms->menuAttributes =              'test="menuAttribute1" onclick="menuAttribute2"';
  21.  
  22. // set link properties
  23. $myCms->linkLength =                  50// shortens the page title in the link
  24. $myCms->linkId =                      false// set no id otherwise it will be repeated
  25. $myCms->linkClass   =                 'linkClass';
  26. $myCms->linkAttributes =              'test="linkAttribute1" onclick="linkAttribute2"';
  27. $myCms->linkBefore =                  'text before link ';
  28. $myCms->linkAfter =                   ' text after link';
  29. $myCms->linkBeforeText =              'text before ';
  30. $myCms->linkAfterText =               ' text after';
  31. $myCms->linkShowThumbnail =           true;
  32. $myCms->linkShowThumbnailAfterText =  false;
  33. $myCms->linkShowPageDate =            true;
  34. $myCms->linkShowCategory =            true;
  35. $myCms->linkCategorySeparator =       ' -> ';
  36.  
  37. // set thumbnail properties
  38. $myCms->thumbnailAlign =              'left';
  39. $myCms->thumbnailId =                 false// set no id otherwise it will be repeated
  40. $myCms->thumbnailClass =              'thumbnailClass';
  41. $myCms->thumbnailAttributes =         'test="thumbnailAttribute1" onclick="thumbnailAttribute2"';
  42. $myCms->thumbnailBefore =             'text before thumbnail ';
  43. $myCms->thumbnailAfter =              ' text after thumbnail';
  44.  
  45. // finally create the menu from the category with ID "1" using the above set properties
  46. $menu $myCms->createMenu('category',1,'table',true,2,true);
  47.  
  48. // displays the menu
  49. foreach($menu as $link{
  50.   echo $link;
  51. }
  52.  
  53.  
  54.  
  55. /*                              *** RESULT *** 
  56. --------------------------------------------------------------------------------
  57. */
  58.  
  59. <table id="menuId" class="menuClass" test="menuAttribute1" onclick="menuAttribute2">
  60. <tr><td>
  61. text before link <a href="?category=1&amp;page=1" title="Example Category: 2010-12-31 Example Page 1"
  62. class="linkClass" test="linkAttribute1" onclick="linkAttribute2">
  63. text before thumbnail
  64. <img src="/path/thumb_page1.png" alt="Thumbnail" title="Example Page 1"
  65. class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" />
  66. text after thumbnail
  67. text before Example Category2010-12-31 Example... text after
  68. </atext after link
  69. </td><td>
  70. text before link <a href="?category=1&amp;page=2" title="Example Category: 2010-11-25 Example Page 2"
  71. class="linkClass" test="linkAttribute1" onclick="linkAttribute2">
  72. text before thumbnail
  73. <img src="/path/thumb_page2.png" alt="Thumbnail" title="Example Page 2"
  74. class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" />
  75. text after thumbnail
  76. text before Example Category2010-11-25 Example... text after
  77. </atext after link
  78. </td>
  79. </tr><tr>
  80. <td>
  81. text before link <a href="?category=1&amp;page=3" title="Example Category: 2010-10-15 Example Page 3"
  82. class="linkClass" test="linkAttribute1" onclick="linkAttribute2">
  83. text before thumbnail
  84. <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 3"
  85. class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" />
  86. text after thumbnail
  87. text before Example Category2010-10-15 Example... text after
  88. </atext after link
  89. </td><td>
  90. text before link <a href="?category=1&amp;page=4" title="Example Category: 2010-09-05 Example Page 4"
  91. class="linkClass" test="linkAttribute1" onclick="linkAttribute2">
  92. text before thumbnail
  93. <img src="/path/thumb_page4.png" alt="Thumbnail" title="Example Page 4"
  94. class="thumbnailClass" test="thumbnailAttribute1" onclick="thumbnailAttribute2" style="float:left;" />
  95. text after thumbnail
  96. text before Example Category2010-09-05 Example... text after
  97. </atext after link
  98. </td></tr>
  99. </table>
  100.  
  101. ?>


Used By
Return Value
  • array - the created menu in an array, ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1651
array createMenuByTags ( string|array $tags,
[string $idType = 'category'],
[int|array|bool $ids = false],
[int|bool $menuTag = false],
[string|bool $linkText = true],
[int|false $breakAfter = false],
[bool $sortByCategories = false])

Parameters

string|array $tags a string with tags seperated by "," or whitespaces, or an array with tags
string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|bool $menuTag (optional) the tag which is used to create the menu, can be an "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag
Default false
string|bool $linkText (optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used
Default true
int|false $breakAfter (optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect
Default false
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false

Description

Name createMenuByTags()
Alias createMenuByTag()

This method uses the $link..., $menu... and $thumbnail... properties.

Create a menu from category or page ID(s) with pages which have one or more of the tags from the given $tags parameter.

Notice: the tags will be compared case insensitive.

The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.

In case no page with the given category or page ID(s) or tags exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example shows only the usage of tags for creating a menu,
  5. for a detailed menu example see createMenu()
  6. */
  7.  
  8. // a session will be started in the "feindura.include.php",
  9. // therefor you have to include this file before the header of the HTML page is sent,
  10. // which means before any HTML Tag.
  11. require('cms/feindura.include.php');
  12.  
  13. // creates a new Feindura instance
  14. $myCms new Feindura();
  15.  
  16. // the tags where the pages in the menu should have atleast one
  17. $tags 'winter summer spring';
  18. // could also be an array like
  19. // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring');
  20.  
  21. // finally create the menu from the category with ID "1" using the above set tags
  22. $menu $myCms->createMenuByTags($tags,'category',1,'table',true,2,true);
  23.  
  24. // displays the menu
  25. foreach($menu as $link{
  26.   echo $link;
  27. }
  28.  
  29.  
  30.  
  31. /*                              *** RESULT *** 
  32. --------------------------------------------------------------------------------
  33. */
  34.  
  35. <table>
  36. <tr><td>
  37. <a href="?category=1&amp;page=1" title="Summer Page">
  38. Summer Page
  39. </a>
  40. </td><td>
  41. <a href="?category=1&amp;page=2" title="Winter Page">
  42. Winter Page
  43. </a>
  44. </td>
  45. </tr><tr>
  46. <td>
  47. <a href="?category=1&amp;page=6" title="Spring Page">
  48. Spring Page
  49. </a>
  50. </td><td></td>
  51. </tr>
  52. </table>
  53.  
  54.  
  55. ?>


Return Value
  • array - the created menu in an array, ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1744
array createMenuByDate ( [string $idType = 'category'],
[int|array|bool $ids = false],
[int|bool|string $monthsInThePast = true],
[int|bool|string $monthsInTheFuture = true],
[int|bool $menuTag = false],
[string|bool $linkText = true],
[int|false $breakAfter = false],
[bool $sortByCategories = false],
[bool $reverseList = false])

Parameters

string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|bool|string $monthsInThePast (optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
int|bool|string $monthsInTheFuture (optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
int|bool $menuTag (optional) the tag which is used to create the menu, can be an "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag
Default false
string|bool $linkText (optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used
Default true
int|false $breakAfter (optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect
Default false
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false
bool $reverseList (optional) reverse the menu listing
Default false

Description

Name createMenuByDate()
Alias createMenuByDates()

This method uses the $link..., $menu... and $thumbnail... properties.

Creates a menu from category or page ID(s) sorted by the page date, with pages which have a page date and the page date fit in the time period from the $monthsInThePast and the $monthsInTheFuture parameter starting from the date today.

The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.

The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.

In case no page with the given category or page ID(s) or tags exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example shows only the usage of a time period for creating a menu,
  5. for a detailed menu example see createMenu()
  6. */
  7.  
  8. // a session will be started in the "feindura.include.php",
  9. // therefor you have to include this file before the header of the HTML page is sent,
  10. // which means before any HTML Tag.
  11. require('cms/feindura.include.php');
  12.  
  13. // creates a new Feindura instance
  14. $myCms new Feindura();
  15.  
  16. // set this property to show the page date in the menu linktext
  17. // the "text before date" and "text after date:" was set in the page editor in the backend
  18. $myCms->linkShowPageDate true;
  19.  
  20. // create the menu from the category with ID "1" using the time period:
  21. // load all pages in the past until 8 months in the future starting from the date today: 31.05.2010
  22. $menu $myCms->createMenuByDate('category',1,true,8,'table',true,2,true,true);
  23.  
  24. // displays the menu
  25. foreach($menu as $link{
  26.   echo $link;
  27. }
  28.  
  29.  
  30.  
  31. /*                              *** RESULT *** 
  32. --------------------------------------------------------------------------------
  33. */
  34.  
  35. <table>
  36. <tr><td>
  37. <a href="?category=1&amp;page=1" title="text before date 2005-10-31 text after date: Oldest Page">
  38. text before date 2005-10-31 text after dateOldest Page
  39. </a>
  40. </td><td>
  41. <a href="?category=1&amp;page=2" title="text before date 2010-11-31 text after date: Newer Page">
  42. text before date 2010-11-31 text after dateNewer Page
  43. </a>
  44. </td>
  45. </tr><tr>
  46. <td>
  47. <a href="?category=1&amp;page=3" title="text before date 2010-12-31 text after date: Newest Page">
  48. text before date 2010-12-31 text after dateNewest Page
  49. </a>
  50. </td><td></td>
  51. </tr>
  52. </table>
  53.  
  54. ?>


Return Value
  • array - the created menu in an array, ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1834
array createMenuBySortFunction ( string $sortCallback,
[string $idType = 'category'],
[int|array|bool $ids = false],
[int|bool $menuTag = false],
[string|bool $linkText = true],
[int|false $breakAfter = false],
[bool $reverseList = false])

Parameters

string $sortCallback the name of the callback function to sort the menu (the callback function is a function which can be passed to usort())
string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|bool $menuTag (optional) the tag which is used to create the menu, can be an "menu", "ul", "ol", "table" or any other tag, if TRUE it uses "div" as a standard tag
Default false
string|bool $linkText (optional) a string with a linktext which all links will use, if TRUE it uses the page titles of the pages, if FALSE no linktext will be used
Default true
int|false $breakAfter (optional) if the $menuTag parameter is "table", this parameter defines after how many "td" tags a "tr" tag will follow, with any other tag this parameter has no effect
Default false
bool $reverseList (optional) reverse the menu listing
Default false

Description

Name createMenuBySortFunction()

Alias createMenuBySort()
Alias createMenuBySortCallback()
Alias createMenuByCallback()

This method uses the $link..., $menu... and $thumbnail... properties.

Creates a menu from category or page ID(s) sorted by a custom sort function, passed in the first parameter $sortCallback.

The $menuTag parameter can be an "ul", "ol" or "table", it will then create the necessary HTML-tags of this element. If its any other tag name it just enclose the links with this HTML-tag.

In case no page with the given category or page ID(s) or tags exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter. Notice: the link which fits the current ID in the $page property will get the class name "active".

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call createMenu('category',1)
  6. and you have a simple array with links of the pages from this category.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // create the sort function, which we use with the createMenuBySortFunction() method
  18. function sortByLastEditDate($a,$b{
  19.   if ($a['lastSaveDate'== $b['lastSaveDate'])
  20.     return 0;
  21.   return ($a['lastSaveDate'$b['lastSaveDate']? -1;
  22. }
  23.  
  24. // now we create the menu from the category with ID "1"
  25. $menu $myCms->createMenuBySortFunction('sortByLastEditDate','category',1,'table',true,2);
  26.  
  27. // displays the menu
  28. foreach($menu as $link{
  29.   echo $link;
  30. }
  31.  
  32.  
  33.  
  34. /*                              *** RESULT *** 
  35. --------------------------------------------------------------------------------
  36. */
  37.  
  38. <table>
  39. <tr><td>
  40. <a href="?category=1&amp;page=2" title="Example Page 2">
  41. Example Page 2
  42. </a>
  43. </td>
  44. <td>
  45. <a href="?category=1&amp;page=1" title="Example Page 1">
  46. Example Page 1
  47. </a>
  48. </td>
  49. </tr><tr>
  50. <td>
  51. <a href="?category=1&amp;page=4" title="Example Page 4">
  52. Example Page 4
  53. </a>
  54. </td>
  55. <td>
  56. <a href="?category=1&amp;page=3" title="Example Page 3">
  57. Example Page 3
  58. </a>
  59. </td></tr>
  60. </table>
  61.  
  62. ?>


Return Value
  • array - the created menu in an array, ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 1911
string getPageTitle ( [int|string|array|bool $ids = false])

Parameters

int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false

Description

Name getPageTitle()
Alias getTitle()

This method uses the $title... properties.

Returns the title of a page. This page title will be generated using the title properties.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>

Example:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call createLink(1) without setting properties
  6. and you have a simple link with the page title.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // set title properties
  18. $myCms->titleLength =              10;
  19. $myCms->titleAsLink =              true;
  20. $myCms->titleShowPageDate =        true;
  21. $myCms->titleShowCategory =        true;
  22. $myCms->titleCategorySeparator =   ' -> ';
  23.  
  24.  
  25. // finally create the title from the page with ID "1" using the above set title properties
  26. $title $myCms->getPageTitle(1);
  27.  
  28. // displays the link
  29. echo $title;
  30.  
  31.  
  32. /*                              *** RESULT *** 
  33. --------------------------------------------------------------------------------
  34. */
  35.  
  36. <a href="?category=1&amp;page=3" title="Example Category 1 -> 31.12.2010 Example Page">
  37. Example Category -> 31.12.2010 Example...
  38. </a>
  39.  
  40. ?>


Uses
Return Value
  • string - the generated page title, ready to display in a HTML-page, or FALSE if the page doesn't exist or is not public
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2017
array showPage ( [int|string|array|bool $ids = false],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true])

Parameters

int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags.
Default true

Description

Name showPage()
Alias showPages()

This method uses the $error..., $title... and $thumbnail... properties.

Returns a page for displaying in a HTML-page. This array will conatin all elements of the page, ready for displaying in a HTML-page.

In case the page doesn't exists or is not public and the $showErrors property is TRUE, an error will be placed in the ['content'] part of the returned array, otherwiese it returns an empty array.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>

Example of the returned array:

  1. <?php
  2.  
  3. array(
  4.   'id' => 1,
  5.   'category' => 'Example Category',
  6.   'pageDate' => '2000-12-31'// format depending on the administrator-settings
  7.   'pageDateTimestamp' => 1325393999,
  8.   'title' => 'Title Example',
  9.   'thumbnail' => '<img src="/path/thumb_page1.png" alt="Thumbnail" title="Title Example" />',
  10.   'thumbnailPath' => '/path/thumb_page1.png',
  11.   'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  12.   'description' => 'Short description of the page',
  13.   'tags' => 'tag1 tag2 tag3',
  14.   'plugins' => array(
  15.           'imageGallery' => array(
  16.               'active'          true,
  17.               'galleryPath'     '/upload/gallery/',
  18.               'imageWidth'      800,
  19.               'imageHeight'     null,
  20.               'thumbnailWidth'  160,
  21.               'thumbnailHeight' null,
  22.               'tag'             'table',
  23.               'breakAfter'      3
  24.           ),
  25.           'pageRating' => array(
  26.               'active' false,
  27.               'value'  0,
  28.               'votes'  0
  29.           )
  30.       )
  31.   )
  32.  
  33. ?>

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call showPage() without setting properties
  6. and it shows the current page given by the $_GET variable.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // set properties
  18. $myCms->xHtml =                  true;
  19.  
  20. $myCms->showErrors =              true;
  21. $myCms->errorTag =               'span';
  22. $myCms->errorId =                'errorId';
  23. $myCms->errorClass =             'errorClass';
  24. $myCms->errorAttributes =        'test="exampleAttribute1" onclick="exampleAttribute2"';
  25.  
  26. $myCms->titleLength =            20;
  27. $myCms->titleAsLink =            true;
  28. $myCms->titleShowPageDate =      true;
  29. $myCms->titleShowCategory =      false// has no effect, because page with ID "1" has no category
  30. $myCms->titleCategorySeparator ' -> ';
  31.  
  32. $myCms->thumbnailAlign =         'left';
  33. $myCms->thumbnailId =            'thumbId';
  34. $myCms->thumbnailClass =         'thumbCLass';
  35. $myCms->thumbnailAttributes =    'test="exampleAttribute1" onclick="exampleAttribute2"';
  36. $myCms->thumbnailBefore =        false;
  37. $myCms->thumbnailAfter =         false;
  38.  
  39.  
  40. // finally, return the page, with ID "1", using the above set properties
  41. $page $myCms->showPage(1,100,true,true);
  42.  
  43. // displays the page (the "\n" creates a line break for a better look)
  44. echo $page['title']."\n";
  45. echo $page['thumbnail']."\n";
  46. echo $page['content'];
  47.  
  48.  
  49. /*                              *** RESULT with page *** 
  50. --------------------------------------------------------------------------------
  51. */
  52.  
  53. <a href="?page=1" title="2010-12-31 Example Page">
  54. 2010-12-31 Example...
  55. </a>
  56. <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 1" id="thumbId"
  57. class="thumbCLass" test="exampleAttribute1" onclick="exampleAttribute2" style="float:left;" />
  58.  
  59. <h2>Example Headline</h2>
  60. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.
  61. Stet clita kasd gubergrenno sea takimata sanctus.</p>
  62. <p>Stet clita kasd gubergrenno sea takimata sanctus est Lorem ipsum dolor sit amet.
  63. Lorem ipsum dolor sit ametconsetetur sadipscing elitrsed diam...</p>
  64. <a href="?page=1">mehr</a>
  65.  
  66.  
  67. /*                              *** RESULT with error *** 
  68. --------------------------------------------------------------------------------
  69. */
  70.  
  71. <span id="errorId" class="errorClass" test="exampleAttribute1" onclick="exampleAttribute2">
  72. The requested page is currently not available.
  73. </span>
  74.  
  75. ?>


Return Value
  • array - with the page elements, ready to display in a HTML-page, or FALSE if the page doesn't exist or is not public
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2097
bool hasPlugins ( [string|array|true $plugins = true],
[int|string|array|bool $ids = false])

Parameters

string|array|true $plugins (optional) the plugin name or an array with plugin names or TRUE to load all plugins
Default true
int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false

Description

Name hasPlugins()

Alias hasPlugin()
Alias isPlugins()
Alias isPlugin()

Check whether the given plugin(s) are activated for the given page.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>


Uses
Return Value
  • bool - whether the plugin(s) are activated or not
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2168
array|string|false showPlugins ( [string|array|true $plugins = true],
[int|string|array|bool $ids = false],
[bool $returnPlugin = true])

Parameters

string|array|true $plugins (optional) the plugin name or an array with plugin names or TRUE to load all plugins
Default true
int|string|array|bool $ids a page ID, array with page and category IDs, or a string/array with "previous","next","first","last" or "random". If FALSE it uses the $page property. (See examples) (can also be a $pageContent array)
Default false
bool $returnPlugin (optional) whether the plugin is returned, or only a boolean to check if the plugin is available for that page (used by Feindura::hasPlugins())
Default true

Description

Name showPlugins()
Alias showPlugin()

Returns the plugin(s) of a page ready for displaying in a HTML page. It can return an array where each element contain the HTML of a plugin (only the activated ones), or if the $plugins parameter is a string with a plugin name (the foldername of the plugin, inside "../feindura_folder/plugins/"), it returns only a string with the HTML of this plugin.

Notice: If the $ids/var> parameter is empty or FALSE it uses the $page property. Example <var$ids parameters:

  1. <?php
  2.   // The "next","previous","first" and "last" is always relative to the current $this->page and $this->category property.
  3.   // If there is an ID, "prev" or "next" for the page value, it will always discard the category value and load the right page.
  4.   // Note: When using "previous","next","first" or "last" it will jump over pages/categories which are not public and return the next one.
  5.   
  6.   empty                  // load the current page
  7.   false/true             // same as above
  8.   array(false,false)     // same as above
  9.   
  10.   2                      // load page with ID 2
  11.   'rand'                 // load a random page of the current category
  12.   array('rand',false)    // same as above
  13.   
  14.   'next'                 // load the next page in the current category
  15.   array('next',false)    // the same as above
  16.   array('next','rand')   // the same as above (it would discard the category ID)
  17.   array(2,45)            // load the page with ID 2 (it would discard the category ID)
  18.   
  19.   array(false,3)         // load the first page of category with ID 3
  20.   
  21.   array(false,'next')    // load the first page of the next category
  22.   array(false,'prev')    // load the first page of the previous category
  23.   
  24.   array('last',false)    // load the last page of the current category
  25.   array('last','next')   // load the last page of the next category
  26.   array('first','last')  // load the first page of the last category
  27.   
  28.   array('rand','next')   // load a random page of the next category
  29.   array('rand','rand')   // load a random page of a random category
  30.   array('first','rand')  // load the first page of a random category
  31. ?>

Example of the returned array:

  1. <?php
  2. /* If you call this method and you give as $plugin parameter only a string with a pluginName,
  3. it returns only a string with this plugin content */
  4.  
  5. $plugins['onePlugin''<p>HTML created by the Plugin</p>
  6.                          <span>What it is depends on the plugin :-)</span>';
  7. $plugins['anotherPlugin''<h1>Another plugin which follows the first one</h1>
  8.                              <p>You can alsocall specific plugins directly
  9.                              when you give the plugin name instead of "true",
  10.                              like in this example</p>';
  11. ...
  12.  
  13. return $plugins;
  14.   
  15. ?>

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example gets all plugins which are activated in the page with ID "2".
  5. You can also request only single plugins, it will then only return a string, with the HTML of the plugin.
  6. */
  7.  
  8. // a session will be started in the "feindura.include.php",
  9. // therefor you have to include this file before the header of the HTML page is sent,
  10. // which means before any HTML Tag.
  11. require('cms/feindura.include.php');
  12.  
  13. // creates a new Feindura instance
  14. $myCms new Feindura();
  15.  
  16. // get the all plugins, which are activated in the page with ID "2"
  17. $plugins $myCms->showPlugins(true,2);
  18.  
  19. // displays the page (the "\n" creates a line break for a better look)
  20. foreach($plugins as $plugin{
  21.   echo $plugin;
  22.   echo '------';
  23. }
  24.  
  25.  
  26. /*                              *** RESULT with page *** 
  27. --------------------------------------------------------------------------------
  28. */
  29.  
  30. <p>HTML created by the Plugin</p>
  31. <span>What it is depends on the plugin :-)</span>
  32. -----
  33. <h1>Another plugin which follows the first one</h1>
  34. <p>You can alsocall specific plugins directly
  35. when you give the plugin name instead of "true"like in this example</p>
  36. -----
  37.  
  38. ?>


Used By
Uses
Return Value
  • array|string|false - with the plugin(s) HTML-code, ready to display in a HTML-page, or an empty Array, or FALSE if the plugin(s) or page doesn't exist or the page is not public
Additional
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2298
array listPages ( [string $idType = 'category'],
[int|array|bool $ids = false],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true],
[bool $sortByCategories = false])

Parameters

string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags.
Default true
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false

Description

Name listPages()
Alias listPage()

This method uses the $error..., $title... and $thumbnail... properties.

List pages by given category or page ID(s).

Returns an array with multiple pages for displaying in a HTML-page.

In case no page with the given category or page ID(s) exist it returns an empty array. Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.

Example of the returned array:

  1. <?php
  2.  
  3. array(
  4.  
  5.   => array(
  6.     'id' => 1,
  7.     'category' => 'A Category',
  8.     'pageDate' => '2010-12-31'// format depending on the administrator-settings
  9.     'pageDateTimestamp' => 1325393999,
  10.     'title' => 'Title Example 1',
  11.     'thumbnail' => false// page has no thumbnail
  12.     'thumbnailPath' => false// page has no thumbnail
  13.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  14.     'description' => 'Short description of the page',
  15.     'tags' => 'tag1 tag2 tag3',
  16.     'plugins' => array (
  17.         'imageGallery' => array(
  18.                 'galleryPath'         => '',
  19.                 'imageWidth'          => 800,
  20.                 'imageHeight'         => null,
  21.                 'thumbnailWidth'      => 160,
  22.                 'thumbnailHeight'     => null,
  23.                 'tag'                 => 'table',
  24.                 'breakAfter'          => 3
  25.                 )
  26.         )
  27.     ),
  28.    
  29.    => array(
  30.     'id' => 5,
  31.     'category' => 'A Category',
  32.     'pageDate' => '2009-12-31',
  33.     'pageDateTimestamp' => 1325393999,
  34.     'title' => 'Title Example 2',
  35.     'thumbnail' => false// page has no thumbnail
  36.     'thumbnailPath' => false// page has no thumbnail
  37.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  38.     'description' => 'Short description of the page',
  39.     'tags' => 'tag3 tag4',
  40.     'plugins' => array ()
  41.     ),
  42.   
  43.    => array(
  44.     'id' => 8,
  45.     'category' => 'Another Category',
  46.     'pageDate' => false// page has no page date
  47.     'pageDateTimestamp' => false,
  48.     'title' => 'Title Example 3',
  49.     'thumbnail' => '<img src="/path/thumb_page3.png" alt="Thumbnail" title="Title Example 3" />',
  50.     'thumbnailPath' => '/path/thumb_page3.png',
  51.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  52.     'description' => 'Short description of the page',
  53.     'tags' => 'tag3 tag1',
  54.     'plugins' => array ()
  55.     )
  56.   )
  57.   
  58.   ...
  59.   
  60. ?>

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call listPages() without setting properties
  6. and list the current category given by $_GET variable.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // set properties
  18. $myCms->xHtml =                  true;
  19.  
  20. $myCms->showErrors =              true;
  21. $myCms->errorTag =               'span';
  22. $myCms->errorId =                'errorId';
  23. $myCms->errorClass =             'errorClass';
  24. $myCms->errorAttributes =        'test="exampleAttribute1" onclick="exampleAttribute2"';
  25.  
  26. $myCms->titleLength =            20;
  27. $myCms->titleAsLink =            true;
  28. $myCms->titleShowPageDate =      true;
  29. $myCms->titleShowCategory =      false// has no effect, because page with ID "1" is not in a category
  30. $myCms->titleCategorySeparator ' -> ';
  31.  
  32. $myCms->thumbnailAlign =         'left';
  33. $myCms->thumbnailId =            'thumbId';
  34. $myCms->thumbnailClass =         'thumbCLass';
  35. $myCms->thumbnailAttributes =    'test="exampleAttribute1" onclick="exampleAttribute2"';
  36. $myCms->thumbnailBefore =        false;
  37. $myCms->thumbnailAfter =         false;
  38.  
  39.  
  40. // finally return the pages from the category with ID "1" and "2" using the above set properties
  41. // the page content will be shorten to "200" characters
  42. $pages $myCms->listPages('category',array(1,2),200,true,true);
  43.  
  44. // displays the pages (the "\n" creates a line break for a better look)
  45. foreach($pages as $page{
  46.   echo $page['title']."\n\n";
  47.   echo $page['thumbnail']."\n";
  48.   echo $page['content']."<br />-----------------------<br />\n";
  49. }
  50.  
  51.  
  52. /*                              *** RESULT with page *** 
  53. --------------------------------------------------------------------------------
  54. */
  55.  
  56. <a href="?category=1&amp;page=2" title="2010-12-31 Example Page 2">
  57. 2010-12-31 Example...
  58. </a>
  59. <h2>Example Headline</h2>
  60. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.
  61. Stet clita kasd gubergrenno sea takimata sanctus.</p>
  62. <a href="?category=1&amp;page=2">mehr</a>
  63. <br />-----------------------<br />
  64.  
  65. <a href="?category=1&amp;page=3" title="2010-12-31 Example Page 2">
  66. 2010-12-31 Example...
  67. </a>
  68. <h2>Another Example Headline</h2>
  69. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.</p>
  70. <h2>And one more Example Headline</h2>
  71. <p>Stet clita kasd gubergrenno sea takimata sanctus est...</p>
  72. <a href="?category=1&amp;page=3">mehr</a>
  73. <br />-----------------------<br />
  74.  
  75. <a href="?category=2&amp;page=1" title="Example Page 1">
  76. Example Page 1
  77. </a>
  78. <img src="/path/thumb_page3.png" alt="Thumbnail" title="Example Page 1" id="thumbId"
  79. class="thumbCLass" test="exampleAttribute1" onclick="exampleAttribute2" style="float:left;" />
  80. <p>Lorem ipsum dolor sit ametconsetetur sadipscing elitrsed diam nonumy eirmod tempor
  81. invidunt ut labore et dolore magna aliquyam eratur sadipscing elitr,
  82. Stet clita kasd...</p>
  83. <a href="?category=2&amp;page=1">mehr</a>
  84. <br />-----------------------<br />
  85.  
  86. ?>


Used By
Return Value
  • array - array with page arrays,containing content and title etc., ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2400
array listPagesByTags ( string|array $tags,
[string $idType = 'category'],
[int|array|bool $ids = false],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true],
[bool $sortByCategories = false])

Parameters

string|array $tags a string with tags seperated by "," or whitespaces, or an array with tags
string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags.
Default true
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false

Description

Name listPagesByTags()
Alias listPagesByTag(), listPageByTags(), listPageByTag()

This method uses the $error..., $title... and $thumbnail... properties.

List pages by given category or page ID(s), which have one or more of the tags from the given $tags parameter.

Notice: the tags will be compared case insensitive.

Returns an array with multiple pages for displaying in a HTML-page. In case no page with the given category or page ID(s) exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example shows only the usage of tags for listing pages,
  5. for a detailed example see listPages()
  6. */
  7.  
  8. // a session will be started in the "feindura.include.php",
  9. // therefor you have to include this file before the header of the HTML page is sent,
  10. // which means before any HTML Tag.
  11. require('cms/feindura.include.php');
  12.  
  13. // creates a new Feindura instance
  14. $myCms new Feindura();
  15.  
  16. // the tags where the pages in the menu should have atleast one
  17. $tags 'winter summer spring';
  18. // could also be an array like
  19. // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring');
  20.  
  21.  
  22. // return the pages from the category with ID "1"
  23. // the page content will be shorten to "200" characters
  24. $pages $myCms->listPagesByTags($tags,'category',1,200,true,true);
  25.  
  26. // displays the pages (the "\n" creates a line break for a better look)
  27. foreach($pages as $page{
  28.   echo $page['title'].'<br />
  29.        Has the following Tags: '.$page['tags']."\n";
  30.   echo $page['content']."<br />-----------------------<br />\n";
  31. }
  32.  
  33.  
  34. /*                              *** RESULT with page *** 
  35. --------------------------------------------------------------------------------
  36. */
  37.  
  38. Example Page 1<br />
  39. Has the following TagsWinter antum
  40.  
  41. <h2>Example Headline</h2>
  42. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.
  43. Stet clita kasd gubergrenno sea takimata sanctus.</p>
  44. <a href="?category=1&amp;page=1">mehr</a>
  45. <br />-----------------------<br />
  46.  
  47. Example Page 2<br />
  48. Has the following Tagswinter spring summer
  49.  
  50. <h2>Another Example Headline</h2>
  51. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.</p>
  52. <h2>And one more Example Headline</h2>
  53. <p>Stet clita kasd gubergrenno sea takimata sanctus est...</p>
  54. <a href="?category=1&amp;page=2">mehr</a>
  55. <br />-----------------------<br />
  56.  
  57. Example Page 3<br />
  58. Has the following Tagsspring antum
  59.  
  60. <p>Lorem ipsum dolor sit ametconsetetur sadipscing elitrsed diam nonumy eirmod tempor
  61. invidunt ut labore et dolore magna aliquyam eratur sadipscing elitr,
  62. Stet clita kasd...</p>
  63. <a href="?category=1&amp;page=3">mehr</a>
  64. <br />-----------------------<br />
  65.  
  66. ?>


Return Value
  • array - array with page arrays,containing content and title etc., ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2498
array listPagesByDate ( [string $idType = 'category'],
[int|array|bool $ids = false],
[int|bool|string $monthsInThePast = true],
[int|bool|string $monthsInTheFuture = true],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true],
[bool $sortByCategories = false],
[ $reverseList = false])

Parameters

string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|bool|string $monthsInThePast (optional) number of months before today, if TRUE it show all pages in the past, if FALSE it loads only pages starting from today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
int|bool|string $monthsInTheFuture (optional) number of months after today, if TRUE it show all pages in the future, if FALSE it loads only pages until today. it can also be a string with a (relative or specific) date format, for more details see: http://www.php.net/manual/de/datetime.formats.php
Default true
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags.
Default true
bool $sortByCategories (optional) if TRUE it sorts the given category or page ID(s) by category
Default false
$reverseList
Default false

Description

Name listPagesByDate()
Alias listPagesByDates(), listPageByDate(), listPageByDates()

This method uses the $error..., $title... and $thumbnail... properties.

List pages by given category or page ID(s) sorted by the page date which have a page date and it fit in the time period from the $monthsInThePast and the $monthsInTheFuture parameter starting from the date today.

The $monthsInThePast and $monthsInTheFuture parameters can also be a string with a (relative or specific) date, for more information see: http://www.php.net/manual/de/datetime.formats.php.

Returns an array with multiple pages for displaying in a HTML-page. In case no page with the given category or page ID(s) exist it returns an empty array.

Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example shows only the usage of tags for listing pages,
  5. for a detailed example see listPages()
  6. */
  7.  
  8. // a session will be started in the "feindura.include.php",
  9. // therefor you have to include this file before the header of the HTML page is sent,
  10. // which means before any HTML Tag.
  11. require('cms/feindura.include.php');
  12.  
  13. // creates a new Feindura instance
  14. $myCms new Feindura();
  15.  
  16. // the tags where the pages in the menu should have atleast one
  17. $tags 'winter summer spring';
  18. // could also be an array like
  19. // $tags = array(0 => 'winter', 1 => 'summer', 2 => 'spring');
  20.  
  21.  
  22. // return the pages from the category with ID "1"
  23. // the page content will be shorten to "200" characters
  24. $pages $myCms->listPagesByTags($tags,'category',1,200,true,true);
  25.  
  26. // displays the pages (the "\n" creates a line break for a better look)
  27. foreach($pages as $page{
  28.   echo $page['title'].'<br />
  29.        Has the following Tags: '.$page['tags']."\n";
  30.   echo $page['content']."<br />-----------------------<br />\n";
  31. }
  32.  
  33.  
  34. /*                              *** RESULT with page *** 
  35. --------------------------------------------------------------------------------
  36. */
  37.  
  38. Example Page 1<br />
  39. Has the following TagsWinter antum
  40.  
  41. <h2>Example Headline</h2>
  42. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.
  43. Stet clita kasd gubergrenno sea takimata sanctus.</p>
  44. <a href="?category=1&amp;page=1">mehr</a>
  45. <br />-----------------------<br />
  46.  
  47. Example Page 2<br />
  48. Has the following Tagswinter spring summer
  49.  
  50. <h2>Another Example Headline</h2>
  51. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.</p>
  52. <h2>And one more Example Headline</h2>
  53. <p>Stet clita kasd gubergrenno sea takimata sanctus est...</p>
  54. <a href="?category=1&amp;page=2">mehr</a>
  55. <br />-----------------------<br />
  56.  
  57. Example Page 3<br />
  58. Has the following Tagsspring antum
  59.  
  60. <p>Lorem ipsum dolor sit ametconsetetur sadipscing elitrsed diam nonumy eirmod tempor
  61. invidunt ut labore et dolore magna aliquyam eratur sadipscing elitr,
  62. Stet clita kasd...</p>
  63. <a href="?category=1&amp;page=3">mehr</a>
  64. <br />-----------------------<br />
  65.  
  66. ?>


Return Value
  • array - array with page arrays,containing content and title etc., ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release
File source:
line 2603
array listPagesBySortFunction ( string $sortCallback,
[string $idType = 'category'],
[int|array|bool $ids = false],
[int|array|bool $shortenText = false],
[bool|string $useHtml = true],
[bool $reverseList = false])

Parameters

string $sortCallback the name of the callback function to sort the pages (the callback function is a function which can be passed to usort())
string $idType (optional) the ID(s) type can be "cat", "category", "categories" or "pag", "page" or "pages"
Default 'category'
int|array|bool $ids (optional) the category or page ID(s), can be a number or an array with numbers (can also be a $pageContent array), if TRUE it loads all pages, if FALSE it uses the $page or $category property
Default false
int|array|bool $shortenText (optional) number of the maximal text length displayed, adds a "more" link at the end or FALSE to not shorten. You can also pass an array: value 1: text length as int, value 2: text string for the link, or a link string. e.g. array(23,false), array(23,'read more'), or array(23,'<a href="…"'>read more</a>')
Default false
bool|string $useHtml (optional) whether the content of the page has HTML-tags or not. It also accepts a string with allowed html tags.
Default true
bool $reverseList (optional) reverse the menu listing
Default false

Description

Name listPagesBySortFunction()

Alias listPagesBySort()
Alias listPagesBySortCallback()
Alias listPagesByCallback()

This method uses the $error..., $title... and $thumbnail... properties.

List pages from category or page ID(s) sorted by a custom sort function, passed in the first parameter $sortCallback. The custom sort function will be executed on the plain $pageContent array returned by the FeinduraBase::loadPagesByType() method.

Returns an array with multiple pages for displaying in a HTML-page.

In case no page with the given category or page ID(s) exist it returns an empty array. Notice: if the $ids parameter is FALSE it uses the $page or $category property depending on the $idType parameter.

Example of the returned array:

  1. <?php
  2.  
  3. array(
  4.  
  5.   => array(
  6.     'id' => 1,
  7.     'category' => 'A Category',
  8.     'pageDate' => '2010-12-31'// format depending on the administrator-settings
  9.     'pageDateTimestamp' => 1325393999,
  10.     'title' => 'Title Example 1',
  11.     'thumbnail' => false// page has no thumbnail
  12.     'thumbnailPath' => false// page has no thumbnail
  13.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  14.     'description' => 'Short description of the page',
  15.     'tags' => 'tag1 tag2 tag3',
  16.     'plugins' => array (
  17.         'imageGallery' => array(
  18.                 'galleryPath'         => '',
  19.                 'imageWidth'          => 800,
  20.                 'imageHeight'         => null,
  21.                 'thumbnailWidth'      => 160,
  22.                 'thumbnailHeight'     => null,
  23.                 'tag'                 => 'table',
  24.                 'breakAfter'          => 3
  25.                 )
  26.         )
  27.     ),
  28.    
  29.    => array(
  30.     'id' => 5,
  31.     'category' => 'A Category',
  32.     'pageDate' => '2009-12-31',
  33.     'pageDateTimestamp' => 1325393999,
  34.     'title' => 'Title Example 2',
  35.     'thumbnail' => false// page has no thumbnail
  36.     'thumbnailPath' => false// page has no thumbnail
  37.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  38.     'description' => 'Short description of the page',
  39.     'tags' => 'tag3 tag4',
  40.     'plugins' => array ()
  41.     ),
  42.   
  43.    => array(
  44.     'id' => 8,
  45.     'category' => 'Another Category',
  46.     'pageDate' => false// page has no page date
  47.     'pageDateTimestamp' => false,
  48.     'title' => 'Title Example 3',
  49.     'thumbnail' => '<img src="/path/thumb_page3.png" alt="Thumbnail" title="Title Example 3" />',
  50.     'thumbnailPath' => '/path/thumb_page3.png',
  51.     'content' => "\n".'<p>Content Text</p>'."\n"// the content has line breaks before and after
  52.     'description' => 'Short description of the page',
  53.     'tags' => 'tag3 tag1',
  54.     'plugins' => array ()
  55.     )
  56.   )
  57.   
  58.   ...
  59.   
  60. ?>

Example usage:

  1. <?php
  2. /*                               *** CODE *** 
  3. --------------------------------------------------------------------------------
  4. This example uses all possible properties.
  5. It's also works much more simple: just call listPages() without setting properties
  6. and list the current category given by $_GET variable.
  7. */
  8.  
  9. // a session will be started in the "feindura.include.php",
  10. // therefor you have to include this file before the header of the HTML page is sent,
  11. // which means before any HTML Tag.
  12. require('cms/feindura.include.php');
  13.  
  14. // creates a new Feindura instance
  15. $myCms new Feindura();
  16.  
  17. // create the sort function, which we use with the listPagesBySortFunction() method
  18. function sortByLastEditDate($a,$b{
  19.   if ($a['lastSaveDate'== $b['lastSaveDate'])
  20.     return 0;
  21.   return ($a['lastSaveDate'$b['lastSaveDate']? -1;
  22. }
  23.  
  24. // now we return the pages from the category with ID "1" and "2"
  25. // the page content will be shorten to "200" characters
  26. $pages $myCms->listPagesBySortFunction('sortByLastEditDate','category',array(1,2),200);
  27.  
  28. // displays the pages (the "\n" creates a line break for a better look)
  29. foreach($pages as $page{
  30.   echo $page['title']."\n\n";
  31.   echo $page['thumbnail']."\n";
  32.   echo $page['content']."<br />-----------------------<br />\n";
  33. }
  34.  
  35.  
  36. /*                              *** RESULT with page *** 
  37. --------------------------------------------------------------------------------
  38. */
  39.  
  40. <a href="?category=1&amp;page=2" title="Example Page 2">
  41. Example Page 2
  42. </a>
  43. <h2>Example Headline</h2>
  44. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.
  45. Stet clita kasd gubergrenno sea takimata sanctus.</p>
  46. <a href="?category=1&amp;page=2">mehr</a>
  47. <br />-----------------------<br />
  48.  
  49. <a href="?category=1&amp;page=3" title="Example Page 3">
  50. Example Page 3
  51. </a>
  52. <h2>Another Example Headline</h2>
  53. <p>Lorem ipsum dolor sit ametconsetetur sadipscing dolores et ea rebum.</p>
  54. <h2>And one more Example Headline</h2>
  55. <p>Stet clita kasd gubergrenno sea takimata sanctus est...</p>
  56. <a href="?category=1&amp;page=3">mehr</a>
  57. <br />-----------------------<br />
  58.  
  59. <a href="?category=2&amp;page=1" title="Example Page 1">
  60. Example Page 1
  61. </a>
  62. <p>Lorem ipsum dolor sit ametconsetetur sadipscing elitrsed diam nonumy eirmod tempor
  63. invidunt ut labore et dolore magna aliquyam eratur sadipscing elitr,
  64. Stet clita kasd...</p>
  65. <a href="?category=2&amp;page=1">mehr</a>
  66. <br />-----------------------<br />
  67.  
  68. ?>


Return Value
  • array - array with page arrays,containing content and title etc., ready to display in a HTML-page, or an empty array
Version
  • 1.0
    ChangeLog
    • 1.0 initial release